package team.fivez.defaultmanage.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import team.fivez.defaultmanage.dao.DefaultReasonDao;
import team.fivez.defaultmanage.domain.DefaultReason;

import java.util.List;

@Component
public class DefaultReasonService {


    private final DefaultReasonDao defaultReasonDao;


    @Autowired
    public DefaultReasonService(DefaultReasonDao defaultReasonDao) {
        this.defaultReasonDao = defaultReasonDao;
    }


    //获取已经启用的原因
    public List<DefaultReason> getUsedList(){
        return defaultReasonDao.getUsedReasonList();
    }

    //获取所有的原因
    public List<DefaultReason> getAllList(){return defaultReasonDao.getList();}

    //修改状态
    public void changeStatus(int status,int number){
        int statusTemp=0;
        if (status==0) statusTemp=1;
        defaultReasonDao.updateUsedStatusByNumber(number,statusTemp);
    }


}
